'use strict';

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var mongokeeper  = require('../lib/mongoosekeeper');

var articleModel = function () {

    var articleSchema = new Schema({
        content     : String, //  发布内容
        type        : Number, //
        pictures    : [{url:String,width:Number,height:Number}], // 配图
        thumbnails  : [{url:String,width:Number,height:Number}], // 缩略图
        tags        : [String], // 标签
        author      : String, //  发布人账号
        author_name : String, //  发布人名称
        create_date : { type: Date, default: Date.now }, //创建时间
        meta        : {
                        votes  : Number, //顶
                        favs   : Number  //收藏
                    }
    });

    return mongokeeper.db.model('article', articleSchema);

};

module.exports = new articleModel();